﻿//====================================================================
// Create by Daniel
// file： YCUserLog.cs
// project ：YunCMS
// Build time：2012-09-22
// modify:
// description:
// ===================================================================
using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using YunCMS.Model;
using YunCMS.IDAL;

namespace YunCMS.BLL
{
    /// <summary>
    /// Business Logic Layer For YCUserLog.
    /// </summary>
    public class YCUserLogBLL
    {
		///<summary>
		/// DAL Instance.
		///</summary>
		public static readonly IYCUserLogDAL dal=DALFactory.CreateYCUserLog();		

		/// <summary>
		/// constructor
		/// </summary>
		public YCUserLogBLL()
		{
		}

		#region Insert update delete
		/// <summary>
		/// insert a YCUserLog
		/// </summary>
		/// <param name="model">YCUserLog</param>
		/// <returns>The id of the new item</returns>
		public int Add(YCUserLog model)
		{
			// Validate input
			if (model == null)
				return 0;
			// Use the dal to insert a new record 
			return dal.Add(model);
		}
				
		/// <summary>
		/// delete a item
		/// </summary>
	    /// <param name="model">id</param>
		/// <returns>affectes rows</returns>
		public int Remove(long id)
		{
			// Validate input
			if(id<0)
				return 0;
			return dal.Delete(id);
		}
				
        /// <summary>
		/// Get a YCUserLog 
		/// </summary>
		/// <param name="ID">id</param>
		/// <returns>YCUserLog entity</returns>
		public YCUserLog GetYCUserLog(long id)
		{
			// Validate input
			if(id<0)
				return null;

			// Use the dal to get a record 
			return dal.GetYCUserLog(id);
		}
		
		/// <summary>
		/// get YCUserLogs
		/// </summary>
		/// <returns>List</returns>
		public IList<YCUserLog> GetList(string sqlstr)
		{
			// Use the dal to get all records 
			return dal.GetList(sqlstr);
		}
			
		
		/// <summary>
        /// if IsExist a item accroding to id
        /// </summary>
        /// <param name="ID">id</param>
        /// <returns>true/false</returns>
		public bool IsExist(long id)
		{
			return dal.IsExist(id);
		}

        public IList<YCUserLog> GetList(string name, DateTime? start, DateTime? end, int pageSize, int pageCurrent)
        {
            if (name == null)
            {
                throw new ArgumentException("参数不正确");
            }
            return dal.GetList(name, start, end, pageSize, pageCurrent);
        }

        public int GetCount(string name, DateTime? start, DateTime? end)
        {
            return dal.GetCount(name, start, end);
        }
        #endregion	
		
    }
}






